import type { SaleOrderRefundVO, SaleOrderRefundForm, SaleOrderRefundQuery } from './model';

import type { ID, IDS } from '#/api/common';
import type { PageResult } from '#/api/common';

import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request';

/**
* 查询退款退货明细列表
* @param params
* @returns 退款退货明细列表
*/
export function saleOrderRefundList(params?: SaleOrderRefundQuery) {
  return requestClient.get<PageResult<SaleOrderRefundVO>>('/hm/saleOrderRefund/list', { params });
}

/**
 * 导出退款退货明细列表
 * @param params
 * @returns 退款退货明细列表
 */
export function saleOrderRefundExport(params?: SaleOrderRefundQuery) {
  return commonExport('/hm/saleOrderRefund/export', params ?? {});
}

/**
 * 查询退款退货明细详情
 * @param refundId id
 * @returns 退款退货明细详情
 */
export function saleOrderRefundInfo(refundId: ID) {
  return requestClient.get<SaleOrderRefundVO>(`/hm/saleOrderRefund/${refundId}`);
}

/**
 * 新增退款退货明细
 * @param data
 * @returns void
 */
export function saleOrderRefundAdd(data: SaleOrderRefundForm) {
  return requestClient.postWithMsg<void>('/hm/saleOrderRefund', data);
}

/**
 * 更新退款退货明细
 * @param data
 * @returns void
 */
export function saleOrderRefundUpdate(data: SaleOrderRefundForm) {
  return requestClient.putWithMsg<void>('/hm/saleOrderRefund', data);
}

/**
 * 删除退款退货明细
 * @param refundId id
 * @returns void
 */
export function saleOrderRefundRemove(refundId: ID | IDS) {
  return requestClient.deleteWithMsg<void>(`/hm/saleOrderRefund/${refundId}`);
}
